package com.woniu34.user.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "tb_user")
public class User {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)//主键生成策略 ： 让数据库自己生成主键
    protected Long userId ;
    protected String userName;
    protected String userAccount;
//    @JsonIgnore//后端传值给前端的时候，转成json后，这个字段不在json里
    protected String userPassword;
    protected String userEmail;
    protected Integer userType;
    protected Integer userStatus;
    protected String userPhone;
    protected String userGender;
    @DateTimeFormat(pattern="yyyy-MM-dd") //前端传入时候的日期格式
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") //向客户端输出的时候，转成json后的日期格式
    protected Date userBirthday;
    protected String userAutograph;
    protected Integer userPoints;
    protected String userPhoto;
    protected Date userLockTime;
}